class CreateProducts < ActiveRecord::Migration
  def self.up
    create_table :products do |t|
      t.column :name, :string
    end
    add_column :deliverables, :product_id, :integer

    product = Product.new :name => "N/A"
    product.save

    Deliverable.find(:all).each do |deliverable|
      if deliverable.product == nil 
        deliverable.product = product
        deliverable.save
      end
    end
  end

  def self.down
    drop_table :products
    remove_column :deliverables, :product_id
  end
end
